var dataset = ee.ImageCollection('LANDSAT/LC08/C01/T1_32DAY_NDVI')
  .filterBounds(roi)
  .filterDate('2014-' + 1 + '-01', '2014-' + 12 + '-31')
  .map(function (image) {
    print(image.reduceRegion({
      reducer: ee.Reducer.mean(),
      geometry: roi,
      maxPixels: 1e13,
      scale: 30
    }))

  });
var colorized = dataset.mean().clip(roi);
print('dateset', dataset);

function getImageByYear(yearStart, yearEnd) {
  var start = yearStart + '-01-01';
  var end = yearStart + '-12-31';
  var result = [];
  for (yearStart; yearStart <= yearEnd; yearStart++) {
    var dataset = ee.ImageCollection('LANDSAT/LE07/C01/T1_32DAY_NDVI')
      .filterBounds(roi)
      .filterDate(start, end)
      .toBands()
      .clip(roi);
    result.push(dataset);
  }
  return result;
}
var imageList = getImageByYear(2000, 2019);
print(imageList);
print(colorized);
var colorizedVis = {
  min: 0.0,
  max: 1.0,
  palette: [
    'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
    '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
    '012E01', '011D01', '011301'
  ],
};

// for(var i=0;i<imageList.length;i++) {
//   Export.image.toDrive({
//   image: imageList[i],
//   description: 2000+i+'years',
//   folder: "lunwen",
//   scale: 30,
//   region:roi,
//   crs: "EPSG:4326",
//   maxPixels: 1e13 });
// }
  Map.centerObject(roi, 8);
print(imageList[0].select(0));
var meanValue = imageList[0]
// print(imageList[0].select(0));
Map.addLayer(roi, {
  color: "red"
}, "roi", true);
Map.addLayer(colorized, colorizedVis, 'ndvi', true);
var imagetest = ee.Image("LANDSAT/LE07/C01/T1_32DAY_NDVI/20000101").clip(roi);
print(imagetest.reduceRegion({
  reducer: ee.Reducer.mean(),
  geometry: roi,
  maxPixels: 1e13,
  scale: 30
}));
Map.addLayer(imagetest, colorizedVis, "layer", true);


Map.centerObject(roi, 8);
Map.addLayer(roi, {
  color: "red"
}, "roi", true);
var dataset = ee.ImageCollection('LANDSAT/LC08/C01/T1')
                  .filterBounds(roi)
                  .filterDate('2017-01-01', '2017-12-31')
                  .mean()
                  .clip(roi)
                  .select(['B4', 'B3', 'B2'])
  Export.image.toDrive({
  image: dataset,
  description: 'weisihao',
  folder: 'weisihao',
  scale: 30,
  region:roi,
  crs: "EPSG:4326",
  maxPixels: 1e13 });